package com.chapter12.exception_;

import java.util.Scanner;

/**
 * @author 宋鑫宇
 * @version 1.0
 */
public class exception {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = 0;
        String str = " ";
        while (true) {
            System.out.println("请输入一个整数：");
            str = scanner.next();
            try {
                a = Integer.parseInt(str);
                System.out.println(a);
                break;
            } catch (Exception e) {
            }
        }
    }
}
